package com.lex.samismyfather;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public abstract class BaseFragment extends Fragment {

    private int layoutResId;
    private View layoutView;

    protected abstract void findView();
    protected abstract void initView();

    public BaseFragment(int layoutResId){
        this.layoutResId = layoutResId;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        layoutView = inflater.inflate(layoutResId,null);
        return layoutView;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        findView();
        initView();
    }

    public View findViewById(int resId){
        return layoutView.findViewById(resId);
    }

}
